package com.lib.framework.widget

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.viewpager.widget.ViewPager


/**
 * viewPager 基类
 *
 * @author keanbin
 */
class BaseViewPager(context: Context, attrs: AttributeSet? = null): ViewPager(context, attrs) {

    private var mIsCanScroll = true

    /**
     * 设置是否可以滚动
     */
    fun setIsCanScroll(b: Boolean) {
        mIsCanScroll = b
    }

    override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
        return mIsCanScroll && super.onInterceptTouchEvent(ev)
    }

    override fun onTouchEvent(ev: MotionEvent): Boolean {
        return mIsCanScroll && super.onTouchEvent(ev)

    }
}